              package com.java.diagnostics.visualizer.parser.vgc.converters;
              
              import com.java.diagnostics.visualizer.data.axes.UnitConverterDefinition;
              import com.java.diagnostics.visualizer.gc.defaultextensions.util.Messages;
              import com.java.diagnostics.visualizer.impl.axes.AbstractUnitConverter;
              import com.java.diagnostics.visualizer.impl.axes.UnitConverterDefinitionImpl;
              import com.java.diagnostics.visualizer.parser.vgc.constants.VGCAxes;
              import java.text.DateFormat;
              import java.text.ParseException;
              import java.text.SimpleDateFormat;
              import java.util.Date;
              
              public class DateUnitConverter extends AbstractUnitConverter
              {
                private DateFormat format;
                private UnitFormatPreferenceHelper helper = new UnitFormatPreferenceHelper();
              
                private static final UnitConverterDefinition definition = new UnitConverterDefinitionImpl(
                  VGCAxes.MILLISECONDS, VGCAxes.TIMESTAMP, VGCAxes.DATE, true);
              
                public DateUnitConverter()
                {
                  String dateFormatStr;
              // deleted by wenguang.huang 
//          if (this.helper.isCustomDateFormatEnabled()) {
//             dateFormatStr = this.helper.getDateFormat();
//            if ((dateFormatStr == null) || (dateFormatStr.equals("")))
//              dateFormatStr = 
//                Messages.getString("DateUnitConverter.date.format");
//          }
//          else {
	          // deleted by wenguang.huang 
                    dateFormatStr = Messages.getString("DateUnitConverter.date.format");
//          }
                  this.format = new SimpleDateFormat(dateFormatStr);
                }
              
                public double convert(double number)
                {
                  return number;
                }
              
                public String formatUnconverted(double number)
                {
                  long milliseconds = Math.round(number);
              
                  return this.format.format(new Date(milliseconds));
                }
              
                public String formatUnconverted(double number, int fractionalDigits)
                {
                  return formatUnconverted(number);
                }
              
                public double parseUnconverted(String date)
                {
                  try
                  {
                    return this.format.parse(date).getTime();
                  } catch (ParseException localParseException) {
                  }
                  return 0.0D;
                }
              
                public UnitConverterDefinition getDefinition()
                {
                  return definition;
                }
              
                public void setOffset(double offset)
                {
                }
              
                protected String getFormatWithUnitsPattern()
                {
                  return "{0}";
                }
              }

